package com.example.bootreceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class BootReceiver extends BroadcastReceiver {
    public BootReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        // an Intent broadcast.
        Log.d("ooo-->","开机启动！！！");
        Toast.makeText(context,"开机启动",Toast.LENGTH_LONG).show();
        Intent it =new Intent(context,MainActivity.class);
        //  创建新的任务栈（因为在非activity中启动无任务栈）
        it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(it);
    }
}
